import { createBrowserRouter } from "react-router-dom";
import App from "../App";
let lazyHome = async () => {
  const { default: Home } = await import("../pages/tabs/Home");
  return {
    element: <Home />,
  };
};
let router = createBrowserRouter([
  {
    path: "/",
    element: <App />,
    children: [
        {
            index:true,
            lazy:lazyHome
        },
      {
        path: "home",
        lazy:lazyHome
      },
      {
        path: "order",
        async lazy() {
          const { default: Order } = await import("../pages/tabs/Order");
          return {
            element: <Order />,
          };
        },
      },
      {
        path: "chat",
        async lazy() {
          const { default: Chat } = await import("../pages/tabs/Chat");
          return {
            element: <Chat />,
          };
        },
      },
      {
        path: "my",
        async lazy() {
          const { default: My } = await import("../pages/tabs/My");
          return {
            element: <My />,
          };
        },
      },
    ],
  },
  {
    path:'/login',
    async lazy() {
          const { default: Login } = await import("../pages/auth/login");
          return {
            element: <Login />,
          };
        },
  }
]);

export default router;
